<?php

// 链接数据库
$mysqli = @new mysqli("127.0.0.1", "root", "root", "school");

if(!$mysqli){
    exit("数据库链接不成功");
}

$mysqli->query("set names utf8");

$sql = "select * from stu";

// $sql = "update stu set age=20 where sid<3";

// $sql = "delete from  stu  where sid>7";

// $sql = "update stu set sex='女' where sname='小明'";

for ($i=0; $i <200 ; $i++) { 
    $sql = "insert into stu (sname,age) value('小马".$i."',".$i.")";
    $res = $mysqli->query($sql);

}
$sql = "select * from stu where sex = '女'";

$res = $mysqli->query($sql);

if(!$res){
    exit('执行失败：失败的代码：'.$mysqli->errno."错误信息".$mysqli->error);
}

$teampArr = [];

while ( $row =$res->fetch_assoc()) {
    $teampArr [] = $row;
}

var_dump($teampArr);

$mysqli->close();



